package cn.mw.cmdb.entity;

import cn.mw.cmdb.service.ServiceChoose;
import cn.mw.cmdb.service.impl.ModelTemplateServiceImpl;
import cn.mw.cmdb.util.DataCreateInfo;
import cn.mw.components.mongodb.anno.AutoId;
import cn.mw.components.mongodb.anno.CMDBProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;
import java.util.List;

@Data
@Document("mw_cmdbmd_template_table")
public class ModelTemplateInfo extends ModelTemplateInfoExpand implements ServiceChoose, DataCreateInfo {
    @CMDBProperty
    @AutoId
    @Schema(description = "id")
    protected String id;

    @Schema(description = "模板名称")
    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    protected String templateName;

    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    @Schema(description = "objId")
    protected String systemObjid;

    @Schema(description = "描述")
    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    protected String description;

    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    @Schema(description = "厂商Id")
    protected String brandId;

    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    @Schema(description = "规格型号Id")
    protected String specificationId;

    @CMDBProperty(searchType = PropertyTypeString.ID)
    @Schema(description = "模型分组Id（资产类型Id）")
    protected String modelGroupId;

    @CMDBProperty(searchType = PropertyTypeString.ID)
    @Schema(description = "模型Id（资产子类型Id）")
    protected String modelId;

    @CMDBProperty(searchType = PropertyTypeInt.ID)
    @Schema(description = "监控协议")
    protected Integer monitorMode;

    @CMDBProperty(searchType = PropertyTypeString.ID,keywordSearch = true)
    @Schema(description = "创建人")
    protected Long creater;

    @CMDBProperty(searchType = PropertyTypeTime.ID)
    @Schema(description = "创建时间")
    protected Date createTime;

    @CMDBProperty(searchType = PropertyTypeString.ID,keywordSearch = true)
    @Schema(description = "修改人")
    protected Long modifier;

    @CMDBProperty(searchType = PropertyTypeTime.ID)
    @Schema(description = "修改时间")
    protected Date modificationTime;

    @CMDBProperty(logicDel = true)
    protected Boolean delFlag = false;

    /**
     * zabbix中对应模板所用的interfaces类型 /agent/JMX/IPMI/SNMP
     */
    @CMDBProperty
    @Schema(description = "zabbix中对应模板所用的interfaces类型 /agent/JMX/IPMI/SNMP，默认0")
    protected Integer interfacesType;

    @CMDBProperty(searchType = PropertyTypeSwitch.ID)
    @Schema(description = "模板启用状态")
    protected Boolean status;

    @CMDBProperty
    @Schema(description = "监控服务器模板信息")
    private List<ServerTemplateInfo> serverTemplates;

    @Override
    @Schema(description = "模型服务Id")
    public String getServiceId() {
        return ModelTemplateServiceImpl.ID;
    }

}
